package com.oyc.demo.util;

public class Result<T> {

    private boolean success;
    private Integer code;
    private String msg;
    private T data;


    private Result(boolean success, String msg,Integer code) {
        this.success = success;
        this.msg = msg;
        this.code=code;
    }


    private Result(boolean success, T data) {
        this.success = success;
        this.data = data;
    }
    
    private Result(boolean success, T data,Integer code) {
    	this.success = success;
    	this.data = data;
    	this.code=code;
    }

    public static <T> Result<T> success(T data) {
        return new Result<T>(true, data,200);

    }

    public static <T> Result<T> error(String msg,Integer code) {
        return new Result<T>(false, msg,code);

    }


	public boolean isSuccess() {
		return success;
	}


	public void setSuccess(boolean success) {
		this.success = success;
	}


	public Integer getCode() {
		return code;
	}


	public void setCode(Integer code) {
		this.code = code;
	}


	public String getMsg() {
		return msg;
	}


	public void setMsg(String msg) {
		this.msg = msg;
	}


	public T getData() {
		return data;
	}


	public void setData(T data) {
		this.data = data;
	}
    
    
}